package com.wyy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.context.request.RequestContextListener;

/**
 * @program: gytcb
 * @author: 吴磊
 * @create: 2021-06-05 13:08
 */
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
@EnableHystrix //开启断路器
public class CommentServiceAppConfig {
    public static void main(String[] args) {
        SpringApplication.run(CommentServiceAppConfig.class, args);
    }
    /**
     * 监听器：监听HTTP请求事件
     * 解决RequestContextHolder.getRequestAttributes()空指针问题
     *
     * @return
     */
    @Bean
    public RequestContextListener requestContextListener() {
        return new RequestContextListener();
    }
}
